#-*- coding:utf8 -*-
from django.db import models

'''
과제
'''
class Project(models.Model):
    project_code = models.CharField(max_length=8, primary_key=True)
    project_desc = models.CharField(max_length=50)
    client_company = models.CharField(max_length=50)
    ordering_company = models.CharField(max_length=50)
    deposit = models.DecimalField(max_digits=14, decimal_places=4)
    contract_date = models.DateField(blank=True, null=True)
    complete_date = models.DateField(blank=True, null=True)

    cdate = models.DateField(blank=True, null=True)
    udate = models.DateField(blank=True, null=True)
    ddate = models.DateField(blank=True, null=True)




class Record(models.Model):
	yyyymmdd = models.CharField(max_length=8)
	proj_code = models.CharField(max_length=8)
	work_type = models.CharField(max_length=8)
	user_id = models.CharField(max_length=100)

	work_hour = models.IntegerField(null=True)

	cdate = models.DateField(blank=True, null=True)
	udate = models.DateField(blank=True, null=True)
	ddate = models.DateField(blank=True, null=True)

	def __unicode__(self):
		return self.yyyymmdd


class Cost(models.Model):
	yyyymmdd = models.CharField(max_length=8)
	proj_code = models.CharField(max_length=8)
	work_type = models.CharField(max_length=8)
	user_id = models.CharField(max_length=100)
	seq = models.IntegerField(unique=True)

	acct_code = models.ForeignKey('Account')
	cost = models.DecimalField(max_digits=8, decimal_places=0)

	cdate = models.DateField(blank=True, null=True)
	udate = models.DateField(blank=True, null=True)
	ddate = models.DateField(blank=True, null=True)

	def __unicode__(self):
		return self.yyyymmdd


class Account(models.Model):
	account_code = models.CharField(max_length=8, primary_key=True)
	account_name = models.CharField(max_length=50)
	use_yn = models.BooleanField(default=True)

	cdate = models.DateTimeField(blank=True, null=True)
	udate = models.DateTimeField(blank=True, null=True)
	ddate = models.DateTimeField(blank=True, null=True)

	def __unicode__(self):
		return self.account_name


